<template>
    <div>
        <p>直接显示getters: {{$store.getters.getInfo}}</p>
        <p>通过mapGetters将getters映射到组件中的计算属性中：{{getInfo}}</p>
        <ul>
            <li v-for='(item, index) in doneTodos' :key='index'>序号：{{index}},num为{{item.num}}</li>
        </ul>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'

export default {
    name: 'getters',
    data() {
        return {
            // todos: []
        }
    },
    computed: {
        ...mapGetters([
            'getInfo',
            'doneTodos'
        ])
    },
    created() {
        // this.todos = this.$store.getters.doneTodos;
        // console.log(this.todos)
    }
}
</script>